package com.example.board_jojo;

import android.app.Activity;
import android.os.Bundle;
import android.view.ContextMenu;
import android.view.Menu;
import android.view.MenuItem;
import android.view.SubMenu;
import android.view.View;
import android.view.ContextMenu.ContextMenuInfo;
import android.widget.TextView;

public class InputActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_input);
		
		TextView tv1 = (TextView)findViewById(R.id.tv_1);
		TextView tv2 = (TextView)findViewById(R.id.tv_2);
		TextView tv3 = (TextView)findViewById(R.id.tv_3);
		
		registerForContextMenu(tv1);
		registerForContextMenu(tv2);
		registerForContextMenu(tv3);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

	@Override
	public void onCreateContextMenu(ContextMenu menu, View v,
			ContextMenuInfo menuInfo) {
		int id = v.getId();
		switch(id)
		{
		case R.id.tv_1 :
			menu.add(0, 1, 0, "치악산");
			menu.add(0, 2, 0, "백두산");
			menu.add(0, 3, 0, "동네 뒷산");
			break;
			
		case R.id.tv_2 :
			menu.add(0, 4, 0, "동해");
			menu.add(0, 5, 0, "서해");
			menu.add(0, 6, 0, "너를 원해");
			break;
			
		case R.id.tv_3 :
			SubMenu sm1 = menu.addSubMenu("사랑하는 사람과?");
			
			sm1.add(0, 7, 0, "짜릿한 폐가");
			sm1.add(0, 8, 0, "무서운 공동묘지");
			sm1.add(0, 9, 0, "공포의 폐광");
			
			SubMenu sm2 = menu.addSubMenu("사랑하고 싶은 사람과?");
			
			sm2.add(0, 10, 0, "남산타워");
			sm2.add(0, 11, 0, "동물원");
			sm2.add(0, 12, 0, "63빌딩");
			break;
		}
		super.onCreateContextMenu(menu, v, menuInfo);
	}
	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		// Handle action bar item clicks here. The action bar will
		// automatically handle clicks on the Home/Up button, so long
		// as you specify a parent activity in AndroidManifest.xml.
		new MainOptionMenu(this, item);
		return super.onOptionsItemSelected(item);
	}
}
